export type ErrorInfo = {
  errno: number;
  message: string;
};

export const userErrorMessages = {
  userValidateFail: {
    errno: 101001,
    message: '输入信息验证失败',
  },
  createUserAlreadyExists: {
    errno: 101002,
    message: '该邮箱已经被注册，请直接登录',
  },
  loginCheckFailInfo: {
    errno: 101003,
    message: '该用户不存在或者密码错误',
  },
  jwtError: {
    errno: 101004,
    message: '登录校验失败',
  },
  phoneVeriCodeAlreadyExists: {
    errno: 101005,
    message: '请勿频繁获取短信验证码',
  },
  veriCodeError: {
    errno: 101006,
    message: '验证码不正确',
  },
  githubOauthError: {
    errno: 101007,
    message: 'Github Oauth 失败',
  },
};

export const workErrorMessages = {
  workValidateFail: {
    errno: 102001,
    message: '输入信息验证失败',
  },
  workNoPermissonFail: {
    errno: 102002,
    message: '没有权限完成操作',
  },
  workNoExsitFail: {
    errno: 102003,
    message: '作品不存在',
  },
  channelValidateFail: {
    errno: 102004,
    message: 'channel验证失败',
  },
};

export const utilErrorMessages = {
  uploadFileFail: {
    errno: 103001,
    message: '文件上传失败',
  },
};

export const errorMessages = {
  ...userErrorMessages,
  ...workErrorMessages,
  ...utilErrorMessages,
};

export type dtoErrorType = keyof typeof errorMessages;
